<!-- 信贷管家的页面 -->
<template>
	<view class="page-box">
		<u-sticky>
			<u-tabs-swiper activeColor="#0081ff" ref="tabs" :list="list" :current="current" @change="change"
				:is-scroll="false" swiperWidth="750"></u-tabs-swiper>
		</u-sticky>
		<mescroll-body ref="mescrollRef" safearea @init="mescrollInit" @down="downCallback" @up="upCallback">
			<view class="list-content">
				<view @click="handleDetail(item)" class="cardBox" v-for="(item,index) in dataList" :key="index">
					<view class="order">
						<view class="store">{{ item.customerName}}</view>
						<view class="u-flex u-row-between">
							<view>管家：{{ item.userName}}</view>
							<view>信息费：{{ item.amount}}元</view>
						</view>
						<view class="store">结算时间：{{ item.creatorTime }}</view>
					</view>
				</view>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	import config from '@/common/js/config.js'
	export default {
		mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
		data() {
			return {
				percent: 50,
				activeColor: '#0081ff',
				striped: false,
				stripedActive: false,
				customerId: undefined,
				dataList: [],
				list: [{
						name: '待审核',
						value: '0',
					},
					{
						name: '已通过',
						value: '1',
					}
				],
				current: 0,
				swiperCurrent: 0,
				tabsHeight: 0,
				loadStatus: ['loadmore', 'loadmore', 'loadmore', 'loadmore'],
				userProvider: {}
			};
		},
		onLoad(options) {
			if (options.id) {
				this.customerId = options.id
			}
			this.userProvider = uni.getStorageSync(config.Global.cache + '_UserProvider');
		},
		methods: {
			upCallback(page) {
				let httpData = {
					currentPage: page.num,
					pageSize: page.size,
					systemType: 2,
					type: this.current
				}

				this.$helper.ajax({
					url: `/api/Jiushi/Customerconsultantdetail`,
					method: 'GET',
					data: httpData,
					success: res => {
						let curPageLen = res.data.data.list.length;
						let totalSize = res.data.data.pagination.total;
						this.mescroll.endBySize(curPageLen, totalSize);
						if (page.num == 1) {
							this.dataList = []
						}
						this.dataList = this.dataList.concat(res.data.data.list);
					}
				});
			},
			handleDetail(detail) {
				let url = `myconsultantdetail?id=${detail.tantId}&uuid=${detail.uuid}`
				uni.navigateTo({
					url: url
				})

			},
			// tab栏切换
			change(index) {
				this.current = index;
				this.mescroll.scrollTo(0, 200);
				this.mescroll.resetUpScroll()
			},
		}
	};
</script>

<style lang="scss" scoped>
	/* #ifndef H5 */
	page {
		height: 100%;
		background-color: #f2f2f2;
	}

	/* #endif */
</style>

<style lang="scss" scoped>
	.order {
		width: 720rpx;
		background-color: #ffffff;
		margin: 20rpx auto;
		border-radius: 20rpx;
		box-sizing: border-box;
		padding: 20rpx;
		font-size: 28rpx;

		.top {
			display: flex;
			justify-content: space-between;

			.left {
				display: flex;
				align-items: center;

				.store {
					margin-right: 10rpx;
				}
			}

			.right {
				color: $u-type-warning-dark;

				.progressBox {
					width: 150rpx;
					float: right;
				}
			}
		}

		.need-remark {
			color: #666;
			font-size: 28rpx;
		}

		.item {
			display: flex;
			margin: 20rpx 0 0;

			.left {
				margin-right: 20rpx;

				image {
					width: 260rpx;
					height: 190rpx;
					border-radius: 10rpx;
				}
			}

			.content {
				margin-left: 10rpx;

				.title {
					font-size: 28rpx;
					line-height: 45rpx;
				}

				.type {
					margin: 6rpx 0;
					font-size: 24rpx;
					color: $u-tips-color;
					text-overflow: -o-ellipsis-lastline;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 3;
					line-clamp: 3;
					-webkit-box-orient: vertical;
				}

				.delivery-time {
					color: #0081ff;
					font-size: 24rpx;
				}
			}

			.right {
				margin-left: 10rpx;
				padding-top: 20rpx;
				text-align: right;

				.decimal {
					font-size: 24rpx;
					margin-top: 4rpx;
				}

				.number {
					color: $u-tips-color;
					font-size: 24rpx;
				}
			}
		}

		.total {
			margin-top: 20rpx;
			text-align: right;
			font-size: 24rpx;

			.total-price {
				font-size: 32rpx;
			}
		}

		.bottom {
			line-height: 70rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.btnBox {
				width: 150rpx;
				display: flex;
				justify-content: space-between;

				.btn {
					line-height: 52rpx;
					width: 140rpx;
					border-radius: 12rpx;
					border: 2rpx solid $u-tips-color;
					font-size: 26rpx;
					text-align: center;
					color: $u-tips-color;
				}

				.evaluate {
					color: $u-type-primary;
					border-color: $u-type-primary;
				}
			}
		}
	}

	.centre {
		text-align: center;
		margin: 200rpx auto;
		font-size: 32rpx;

		image {
			width: 300rpx;
			border-radius: 50%;
			margin: 0 auto;
		}

		.tips {
			font-size: 24rpx;
			color: #999999;
			margin-top: 20rpx;
		}

		.btn {
			margin: 80rpx auto;
			width: 200rpx;
			border-radius: 32rpx;
			line-height: 64rpx;
			color: #ffffff;
			font-size: 26rpx;
			background: linear-gradient(270deg, #1cbbb4 0%, #0081ff 100%);
		}
	}

	.wrap {
		display: flex;
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
		background: #f1f1f1;
	}

	.swiper-box {
		flex: 1;
	}

	.swiper-item {
		height: 100%;
	}
</style>,